package com.yb.java.observer;

/**
 * @program: design-pattern
 * @description: 观察者模式验证类
 * @author: Mr.Bo
 * @create: 2021-04-27 23:34
 **/
public class ObserverPatternDemo {

    public static void main(String[] args) {
        Subject subject = new Subject();
        // 创建观察者实体类
        new HexaObserver(subject);
        new OctalObserver(subject);
        new BinaryObserver(subject);

        System.out.println("First state change: 15");
        subject.setState(15);
        System.out.println("Second state change: 10");
        subject.setState(10);
    }
}
